﻿using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class NotificationManager : Singleton<NotificationManager>
{
    [SerializeField]
    private GameObject helperImage;
    [SerializeField]
    private float firstShowDelay;
    [SerializeField]
    private GameObject[] enableAfterInstruction;
    [SerializeField]
    private TextMeshProUGUI finalWords;

    private IEnumerator Start()
    {
        yield return new WaitForSeconds(firstShowDelay);
        for (int i = 0; i < enableAfterInstruction.Length; i++)
        {
            enableAfterInstruction[i].SetActive(true);
        }
        OnShowHelper();
    }

    public void OnZoomInIT()
    {
        for (int i = 0; i < enableAfterInstruction.Length; i++)
        {
            enableAfterInstruction[i].SetActive(false);
        }
    }

    public void OnFinish()
    {
        if(GameFlowManager.Instance.Won)
        {
            finalWords.text = "Congrats, the IT is still alive!\nPress R to start another boring day.";
        }
        else
        {
            finalWords.text = "Duuuuuuuuude!\nOK, press R to recruit another IT.";
        }
    }

    public void OnShowHelper()
    {
        helperImage.SetActive(true);
        Time.timeScale = 0;
    }

    public void OnCloseHelper()
    {
        helperImage.SetActive(false);
        Time.timeScale = 1;
    }
}
